package com.informationsystem.webapp.action;

import java.util.List;

import com.informationsystem.model.Video;
import com.informationsystem.service.VideoManager;

public class InfoCenter_Video_Action extends BaseAction{
	private VideoManager videoManager;
	private List videoList;
	private Video video;
	private Long id;
	public VideoManager getVideoManager() {
		return videoManager;
	}

	public void setVideoManager(VideoManager videoManager) {
		this.videoManager = videoManager;
	}

	public List getVideoList() {
		return videoList;
	}

	public void setVideoList(List videoList) {
		this.videoList = videoList;
	}

	public Video getVideo() {
		return video;
	}

	public void setVideo(Video video) {
		this.video = video;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String list() {
		setVideoList(videoManager.getVideoList());
		return SUCCESS;
	}

	public String view() {
		if (getId() != null) {
			setVideo(videoManager.get(getId()));
			video.setViewTimes(video.getViewTimes() + 1);
			videoManager.save(video);
		} else {
			setVideo(new Video());
		}

		return SUCCESS;
	}
}
